var G;
function Link(A) {
    $("#Products").removeClass("InActive").addClass("Active").parent().removeClass("InActiveDiv").addClass("ActiveDiv");
    $("#Cylinders").removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#Main").removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#Downloads").removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#Contact").removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#About").removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#SJSiFrame").attr({ "src": "Products.html" });
    G = A;
    return false;
}
function Show(Main, A1, A2, A3, A4, A5,A6) {
    $("#" + Main).removeClass("InActive").addClass("Active").parent().removeClass("InActiveDiv").addClass("ActiveDiv");
    $("#" + A1).removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#" + A2).removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#" + A3).removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#" + A4).removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#" + A5).removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    $("#" + A6).removeClass("Active").addClass("InActive").parent().removeClass("ActiveDiv").addClass("InActiveDiv");
    //$("#SJSiFrame").css({ "height": "700px" });
       //------------------------------- iFrame Auto Resize ---------------------------------------------------------------
    var frame1 = document.getElementById("SJSiFrame");
    var loadingDisplay = document.getElementById("Loading").style;
    loadingDisplay.display = "block";
    if (frame1.onload == null) {
        frame1.onload = function() { loadingDisplay.display = "none" };
        if (window.attachEvent) { frame1.attachEvent("onload", frame1.onload); }
    }
    switch (Main) {
        case "Enquiry":
            $("#SJSiFrame").attr({ "src": Main + ".aspx" });
            break;
        default:
            $("#SJSiFrame").attr({ "src": Main + ".html" });
    }
}
$(document).ready(function() {
    // ---------- iFrame Auto Height --------------------------
    $("#SJSiFrame").load(function() {
        if ($.browser.msie) {
            h = $("#SJSiFrame").contents().find("body").height() + 100;
        }
        else {
            h = $("#SJSiFrame").contents().find("html").height() + 100;
        }
        //alert(h);
        $("#SJSiFrame").css({ "height": h + "px" });
        $("#Mid").css({ "height": h + "px" });
        $("#MidH").css({ "height": h + 30 + "px" });
        if (!(G == null)) {
            $("#SJSiFrame").contents().find("#PdtiFrame").attr({ "src": "Profiles/" + G + ".html" });
        }
    });
    //------------- Water Mark ------------------------
    $("#Auto").click(function() {
        $("#Auto").removeClass("SelTxt").addClass("UnSelTxt");
        var Txt = $("#Auto").val();
        if (Txt == "Seal Search") {$("#Auto").val("");}
        else {$("#Auto").val(Txt).css({});}
    });
    $("#Auto").blur(function() {
        $("#Auto").removeClass("UnSelTxt").addClass("SelTxt");
        var Txt = $("#Auto").val();
        if (Txt == null || Txt == "") {$("#Auto").val("Seal Search");}
    });
    // ------------------------ Auto Complete ----------------------------
    $(function() {
        var Seals = ["Wiper", "Rod Seals", "Piston Seals", "Rotary Seals", "Guide Elements", "Back-up Elements", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "S10-11-12", "S13-14-15", "S16", "S17", "S18", "S19", "S20", "S21", "S22", "S23", "S25-26-27", "S29-30-31", "K1", "K2", "K3", "K4", "K5", "K6", "K7", "K8", "K9", "K10-11-12", "K13-14-15", "K16", "K17", "K18", "K19", "K20", "K21", "K22", "K23", "K24", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R0-13", "R13", "R14", "R15", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "ST8", "ST9", "ST10", "ST11", "ST12", "ST13"];
        function log(message) {
            Link(message);
            $("#Auto").val("Test");
        }
        $("#Auto").autocomplete({
            source: Seals,
            select: function(event, ui) {
                log(ui.item ? ui.item.value : "Nothing selected, input was " + this.value);
            }
        });
    });
});
